package com.cssw.fyzb.busi.api.team;

import com.cssw.fyzb.busi.service.team.TeamService;
import com.ydn.appserver.Action;
import com.ydn.appserver.Request;
import com.ydn.appserver.Response;
import com.ydn.appserver.annotations.Function;
import com.ydn.appserver.annotations.Parameter;
import com.ydn.appserver.annotations.Type;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Function(description = "获取团队人数", parameters = {
        @Parameter(name = "userId", type = Type.String, description = "用户标识", required = true)
})
@Component
public class GetTeamNum  implements Action {

    @Autowired
    private TeamService teamService;

    @Override
    public Response execute(Request request) throws Exception {
        Long userId = request.getLong("userId");
        return Response.success("").put("num", teamService.getTeamNum(userId));
    }
}
